package com.nbsaas.boot.agent.rest.convert;

import com.nbsaas.boot.entity.agent.AgentCatalog;
import com.nbsaas.boot.agent.api.domain.request.AgentCatalogRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.entity.agent.AgentCatalog;

/**
* 请求对象转换成实体对象
*/

public class AgentCatalogEntityConvert  implements Converter<AgentCatalog, AgentCatalogRequest> {

    @Override
    public AgentCatalog convert(AgentCatalogRequest source) {
        AgentCatalog result = new AgentCatalog();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getParent()!=null){
                    AgentCatalog parent =new AgentCatalog();
                    parent.setId(source.getParent());
                    result.setParent(parent);
                    }
        return result;
    }
}

